package com.wu.ssm.mybatis;

/**
 * Created by wzf on 2018/11/11/011.
 */
public class Main {
    public static void main(String[] args) {

        SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();

        //由spring加载SqlSessionFactoryBean来初始化sqlSessionFactory
        MySqlSessionFactory sqlSessionFactory = sqlSessionFactoryBean.buildSqlSessionFactory();

        MyDefaultSqlsession sqlsession = sqlSessionFactory.openSession(true);

       //MyDefaultSqlsession sqlsessionNoAutoCommit = sqlSessionFactory.openSession();

        UserMapper mapper = sqlsession.getMapper(UserMapper.class);
        User userById = mapper.getUserById(1L);
        System.out.println(userById);

    }
}
